#include "DependencyContainer.h"

#include "concrete/console/AccusationView.h"
#include "concrete/console/GameplayView.h"
#include "concrete/console/BoardView.h"
#include "concrete/console/DeductionView.h"


using namespace Views;

DependencyContainer::DependencyContainer(Controllers::GameplayController* controller):
gameplay_controller(controller), gameplay_view(NULL), board_view(NULL), deduction_view(NULL), accusation_view(NULL)
{
}

DependencyContainer* DependencyContainer::instance = NULL;

void DependencyContainer::initialize(Controllers::GameplayController* controller)
{
	instance = new DependencyContainer(controller);
}

DependencyContainer* DependencyContainer::getInstance()
{
	return instance;
}

IGameplayView* DependencyContainer::getGameplayViewInstance()
{
	if (gameplay_view == NULL) {
		gameplay_view = new Console::GameplayView(gameplay_controller);
	}
	return gameplay_view;
}

IBoardView* DependencyContainer::getBoardViewInstance()
{
	if (board_view == NULL) {
		board_view = new Console::BoardView(gameplay_controller);
	}
	return board_view;
}

IDeductionView* DependencyContainer::getDeductionViewInstance()
{
	if (deduction_view == NULL) {
		deduction_view = new Console::DeductionView();
	}
	return deduction_view;
}

IAccusationView* DependencyContainer::getAccusationViewInstance()
{
	if (accusation_view == NULL) {
		accusation_view = new Console::AccusationView();
	}
	return accusation_view;
}
